fix(weights): produce copy-pasteable retry command after commit#928
fix(weights): produce copy-pasteable retry command after commit#928boskodev790 wants to merge 1 commit into
Conversation
thewhaleking
left a comment
There was a problem hiding this comment.
I'm confused. These aren't even used anymore, hence why the entire weights command is hidden.
bc9d11a to
7ee83dd
Compare
|
Rebased onto @thewhaleking — fully agree the surface is hidden, but the |
After btcli weights commit, the "To manually retry ... run" message
printed the retry command with three issues that made it unparseable:
- Missing the `btcli weights reveal` prefix, so the user could not run
the printed line as-is.
- List arguments were rendered via Python/NumPy repr (`[1, 2, 3]` and
`[0.5 0.3 0.2]`), but the `weights reveal` subcommand parses them
through `parse_to_list` in cli.py, which splits on commas.
- The flag `--reveal-using-salt` does not exist on `weights reveal`;
the real flag is `--salt`.
Extract `_build_reveal_retry_command` as a pure helper and format
--uids / --weights / --salt as comma-separated lists, matching the
help text ("e.g. -u 1,2,3 ...") and `parse_to_list`.
Adds `tests/unit_tests/test_weights_retry_command.py` pinning the
command shape, list-arg formatting, and the regression against the
numpy-repr / `--reveal-using-salt` output.
Co-authored-by: Cursor <cursoragent@cursor.com>
7ee83dd to
040a16b
Compare
|
Follow-up |
It doesn't really make sense to add me features to deprecated commands |
Summary
btcli weights commitsucceeds,_commit_revealinbittensor_cli/src/commands/weights.pyprints a "To manually retry after ... run" message. The printed string is currently unparseable three ways, so copy-pasting it never works:btcli weights revealprefix — the line is just flags, with no subcommand.[1, 2, 3]for uids/salt,[0.5 0.3 0.2]for the numpy weights array).weights revealparses these throughparse_to_listincli.py, which splits on commas per the help text (e.g. -u 1,2,3 ...).--reveal-using-saltdoes not exist onweights reveal; the real flag is--salt._build_reveal_retry_commandas a pure module-level helper and format--uids/--weights/--saltas comma-separated lists. Update the call site in_commit_revealto use it.tests/unit_tests/test_weights_retry_command.py(2 cases) pinning the command shape and asserting regressions against[/]in the output and the legacy--reveal-using-saltflag name.Related Issues
N/A — code review. Line 183 has been this way since 2024-08-22 (
git blame); no open or closed PR addresses the format (search:cli_retry_cmd/reveal-using-salt→ 0 matches).Type of Change
Testing
tests/unit_tests/test_weights_retry_command.pycovering the positive shape and the two regressions (numpy repr leakage,--reveal-using-salt).pytest tests/unit_tests/— 350 passed).ruff formaton both files per CONTRIBUTING.md.Checklist
parse_to_list)